//
//  RightCollectionViewCell.swift
//  BellManage
//
//  Created by Bestsch on 16/3/30.
//  Copyright © 2016年 wsl. All rights reserved.
//

import UIKit

class RightCollectionViewCell: UICollectionViewCell {
    
    var icon, right, bottom: UIImageView!
    var number, title: UILabel!
    
    override init(frame: CGRect) {
       super.init(frame: frame)
       
        icon = UIImageView.init(frame: CGRect.zero)
        
        right = UIImageView.init(frame: CGRect(x: self.bounds.size.width-1, y: 0, width: 1, height: self.bounds.size.height))
        right.backgroundColor = UIColor.init(hexString: "f2f2f2", alpha: 1)
        
        bottom = UIImageView.init(frame: CGRect(x: 0, y: self.bounds.size.height-1, width: self.bounds.size.width, height: 1))
        bottom.backgroundColor = UIColor.init(hexString: "f2f2f2", alpha: 1)
        
        title = UILabel.init(frame: CGRect.zero)
        title.font = UIFont.systemFont(ofSize: 14)
        title.textColor = UIColor.black
        title.backgroundColor = UIColor.clear
        title.textAlignment = NSTextAlignment.center
        
        self.contentView.addSubview(icon)
        self.contentView.addSubview(title)
        self.contentView.addSubview(bottom)
        self.contentView.addSubview(right)
        
        let phoneType = getPhoneMode()
        
        
        if phoneType == "iPhone 5" || phoneType == "iPhone 5C" || phoneType == "iPhone 5S" {
            icon.frame = CGRect(x: (self.bounds.size.width-30)/2, y: (self.bounds.size.height-30-25)/2+5, width: 30, height: 30)
            title.frame = CGRect(x: 0, y: self.icon.frame.maxY+5, width: self.bounds.size.width, height: 20)
            title.font = UIFont.systemFont(ofSize: 12)

        }else if phoneType == "iPhone 4" || phoneType == "iPhone 4S" {
            icon.frame = CGRect(x: (self.bounds.size.width-20)/2, y: (self.bounds.size.height-20-25)/2+5, width: 20, height: 20)
            title.frame = CGRect(x: 0, y: self.icon.frame.maxY+5, width: self.bounds.size.width, height: 20)
            title.font = UIFont.systemFont(ofSize: 12)
        }else {
            icon.frame = CGRect(x: (self.bounds.size.width-50)/2, y: (self.bounds.size.height-50-25)/2+5, width: 50, height: 50);
            title.frame = CGRect(x: 0, y: self.icon.frame.maxY+5, width: self.bounds.size.width, height: 22);
            title.font = UIFont.systemFont(ofSize: 14)
        }
       
    }
    
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
}
